/***********************************************************************
 * Module:  Sinistre.java
 * Author:  a.kanwar
 * Purpose: Defines the Class Sinistre
 ***********************************************************************/

import java.util.*;

public class Sinistre {
   
   /**********************************************************************
    * Attribute
    **********************************************************************/ 
    
   private int idSinistre;
   private java.util.Date dateSinistre;
   private java.lang.String libelle;
   private java.lang.String lieu;
   private float montant;
   
   public Vehicule vehicule;

   
   /**********************************************************************
    * Constructor
    **********************************************************************/
   
   public Sinistre(int idSinistre, Date dateSinistre, String libelle, String lieu, float montant, Vehicule vehicule) {
        this.idSinistre = idSinistre;
        this.dateSinistre = dateSinistre;
        this.libelle = libelle;
        this.lieu = lieu;
        this.montant = montant;
        this.vehicule = vehicule;
    }

    public Sinistre(Date dateSinistre, String libelle, String lieu, float montant, Vehicule vehicule) {
        this.dateSinistre = dateSinistre;
        this.libelle = libelle;
        this.lieu = lieu;
        this.montant = montant;
        this.vehicule = vehicule;
    }

    
    /**********************************************************************************************************************
     * getter and setter
     *  
     */
    public int getIdSinistre() {
        return idSinistre;
    }

    public void setIdSinistre(int idSinistre) {
        this.idSinistre = idSinistre;
    }

    public Date getDateSinistre() {
        return dateSinistre;
    }

    public void setDateSinistre(Date dateSinistre) {
        this.dateSinistre = dateSinistre;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    public String getLieu() {
        return lieu;
    }

    public void setLieu(String lieu) {
        this.lieu = lieu;
    }

    public float getMontant() {
        return montant;
    }

    public void setMontant(float montant) {
        this.montant = montant;
    }

    @Override
    public String toString() {
        return "Sinistre{" + "idSinistre=" + idSinistre + ", dateSinistre=" + dateSinistre + ", libelle=" + libelle + ", lieu=" + lieu + ", montant=" + montant + ", vehicule=" + vehicule + '}';
    }
   

   
   
   
   
   
   
   
   
   
   
   
   
   /*********************************************************************
    * generate code by power AMC
    **********************************************************************/
   /** @pdGenerated default parent getter */
   public Vehicule getVehicule() {
      return vehicule;
   }
   
   /** @pdGenerated default parent setter
     * @param newVehicule */
   public void setVehicule(Vehicule newVehicule) {
      if (this.vehicule == null || !this.vehicule.equals(newVehicule))
      {
         if (this.vehicule != null)
         {
            Vehicule oldVehicule = this.vehicule;
            this.vehicule = null;
            oldVehicule.removeSinistre(this);
         }
         if (newVehicule != null)
         {
            this.vehicule = newVehicule;
            this.vehicule.addSinistre(this);
         }
      }
   }

}